﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using dotUML.System;

namespace dotUML.Core.Common
{
    /// <summary>
    /// Factory class which creates dotUML errors and returns
    /// them via IError interface.
    /// </summary>
    public static class ErrorFactory
    {
        /// <summary>
        /// Create an error.
        /// </summary>
        /// <param name="ErrorType">Type of error.</param>
        /// <param name="ErrorMessage">Error message.</param>
        /// <returns>dotUML Error via IError interface.</returns>
        public static IError NewError(EErrorType ErrorType, string ErrorMessage)
        {
            IError result;
            
            result = (IError)InstrumentationManager.InstrumentObject(new Error(), EInstrumentationType.Logging);
            result.ErrorType = ErrorType;
            result.ErrorMessage = ErrorMessage;
            
            return result;
        }
    }
}
